package cate.game.server.configuration;

import cate.game.db.GameMongoDao;
import cate.game.server.GameServerApplication;
import cp.server.template.gs.GsEnvPostProcessor;
import cp.solution.business.game.boot.GameProcessBootstrap;
import cp.solution.define.GameFeature;
import easy.java.io.http.LocationSearch;

public class GameServerEnvPostProcessor extends GsEnvPostProcessor {

    @Override
    protected String getProcessCodeProp() {
        return "cate.game.process-code";
    }
    @Override
    protected String getConsoleBaseUriProp() {
        return "cate.console.uri";
    }
    @Override
    protected String getSecretProp() {
        return "cate.secret";
    }
    @Override
    protected String getWebSchemeProp() {
        return "cate.game.web-scheme";
    }
    @Override
    protected String getWsSchemeProp() {
        return "cate.game.ws-scheme";
    }
    @Override
    protected String getWsPortProp() {
        return "cate.game.ws-port";
    }

    @Override
    protected String getStartCmdCode() {
        return GameServerApplication.startCmd.code;
    }

    @Override
    protected void afterProcessEnvironment(GameProcessBootstrap bootstrap) {
        LocationSearch processFeatures = bootstrap.getProcess().toFeatureSearch();
        if(processFeatures.getBoolean(GameFeature.NEW_MONGO_TEMPLATE, false)) {
            print("检测到 特性 启用了 新模板 (新的Mongo操作方式)");
            GameMongoDao.ENABLE_NEW_TEMPLATE = true;
        }
        print("GameMongoDao.ENABLE_NEW_TEMPLATE = {}", GameMongoDao.ENABLE_NEW_TEMPLATE);
    }
}
